package cn.lger.icollege.entity;

import com.fasterxml.jackson.annotation.*;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * Code that Changed the World
 * Pro said
 * Created by Pro on 2018-04-15.
 */
@Entity
@Setter
@Getter
public class Notice implements Serializable {

    @Id
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
    private String id;

    private String title = " ";

    @Type(type = "text")
    private String content = " ";

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime createDate;

    @ManyToOne
    private Classroom classroom;

    @ManyToOne
    @JsonIgnoreProperties({"classrooms", "address", "phone", "news", "role", "iconPath", "username"})
    private Teacher teacher;

}